import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/home/index.vue'
import search from '../views/login/search.vue'
import shop from '../views/shop/shop.vue'
// 二级路由
import cart from '@/views/home/children/cart.vue'
import cla from '@/views/home/children/cla.vue'
import find from '@/views/home/children/find.vue'
import index from '@/views/home/children/index.vue'
import my from '@/views/home/children/my.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      redirect:'/home/index'
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      children: [
        {
          path: 'cart',
          name: 'cart',
          component: cart,
        },
        {
          path: 'index',
          name: 'index',
          component: index,
        },
        {
          path: 'my',
          name: 'my',
          component: my,
        },
        {
          path: 'find',
          name: 'find',
          component: find,
        },
        {
          path: 'cla',
          name: 'cla',
          component: cla,
        },
      ]
    },
    {
      path: '/search',
      name: 'search',
      component: search,
    },
    {
      path: '/shop',
      name: 'shop',
      component: shop,
    },
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (About.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import('../views/AboutView.vue'),
    // },
  ],
})

export default router
